package com.itheima.d3_abstract;

public class Test3 {
    public static void main(String[] args) {
        String type = "web";
        OnlinePay pay = null;
        if ("web".equals(type)) {
            pay = new AbcPay();
        } else if ("abc".equals(type)) {
            pay = new WebPay();
        }
        pay.pay(100);
    }
}


    abstract class OnlinePay{
        public abstract void pay(double money);
    }
     class AbcPay extends OnlinePay{

        @Override
        public void pay(double money) {
            System.out.println("已接入中国农业银行");
        }
    }
     class WebPay extends OnlinePay{
        @Override
        public void pay(double money) {
            System.out.println("已接入银联支付");
        }
    }

